package com.fone.player.activity.local;

import java.text.CollationKey;
import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;

import com.fone.player.entity.MediaFile;

public class CollatorComparator implements Comparator<MediaFile> {
	private Collator collator;

	public CollatorComparator() {
		collator = Collator.getInstance(Locale.CHINA);
	}
	
	
	@Override
	public int compare(MediaFile object1, MediaFile object2) {
		CollationKey key1 = collator.getCollationKey(object1.getMediaFileNameSuffix());
		CollationKey key2 = collator.getCollationKey(object2.getMediaFileNameSuffix());
		return key1.compareTo(key2);
	}
}